#include <stdio.h>

int main() {
	int arr[3] = {0};
	int n = 0;
	int num = 0;
	int count = 0;
	int i = 0;
	scanf("%d", &n);
	for ( i = 1; ; i++) {
		count++;
		if (i % 7 == 0 || i % 10 == 7 || ((i / 10) % 10) == 7 || (i / 100) % 10 == 7) {
			num = (i - 1) % 3;
			arr[num]++;
			count--;
		}
		if (count == n)
			break;
	}
	for (i = 0; i < 3; i++) {
		printf("%d ", arr[i]);
	}
	return 0;
}